package by.demchenko.sample.services;

import by.demchenko.sample.datamodel.Course;
import by.demchenko.sample.datamodel.Person;
import by.demchenko.sample.datamodel.Schedule;
import by.demchenko.sample.datamodel.Section;
import by.demchenko.sample.datamodel.enums.ScheduleStatus;

import javax.persistence.metamodel.SingularAttribute;
import javax.transaction.Transactional;
import java.util.List;

public interface CourseService {

    Course get(Integer id);

    List<Course> getAll();

    @Transactional
    void save(Course course);

    @Transactional
    void saveOrUpdate(Course newCourse);

    @Transactional
    void delete(Integer id);

    Integer getCount();

    List<Schedule> getAllCourseRegistrations();

    List<Course> getCourseRegistrationBySection(Section section);

    List<Course> getCourseRegistrationForTable(Person teacher);

    List<Course> getCourseRegistrationStatus(ScheduleStatus status);

    List<Course> getAll(boolean fetchJoins);

    List<Course> getAll(SingularAttribute<Course, ?> attr, boolean ascending, int startRecord, int pageSize, boolean fetchJoins);

    List<Course> getCoursesBySection(Section section);

    Course getByName(String name);
}